import "./App.css";
import React from "react";

class App extends React.Component {
  // 1.可以拿到dom节点
  constructor() {
    super();
    this.dom_ref = React.createRef();
    // 在这里是拿不到ref
    console.log("constructor", this.dom_ref);
    // debugger;
  }
  componentDidMount() {
    console.log("componentDidMount", this.dom_ref);
  }
  render() {
    return <div ref={this.dom_ref}>Hello World</div>;
  }
}
export default App;
